package com.duqc.util;

import lombok.SneakyThrows;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

/**
 * @ClassName DocumentUtil
 * @Description DocumentUtil
 * @Author duqc
 * @Date 2023/4/25
 **/
public class DocumentUtil {

    @SneakyThrows
    public static void main(String[] args) {
        String url = "http://175.6.46.174:8081/PrjDeclare/spProjectCompiling.do";
        Document document = Jsoup.connect(url).get();
        Elements select = document.select("div.list-main ul li a");
        for (int i = 0; i < 10; i++) {
            Element element = select.get(i);
            String url1 = element.attr("href");
            String text = element.text();
            System.out.println("科技政策" + (i + 1) + "：" + text + "\n" + url1);
        }
    }

}
